package com.ruoyi.system.controller;

import com.ruoyi.system.domain.SysGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.system.service.ISysGroupService;

/**
 * 角色组 提供者
 *
 * @author ruoyi
 * @date 2020-06-19
 */
@RestController
@RequestMapping("sysGroup")
public class SysGroupController extends BaseController
{

	@Autowired
	private ISysGroupService sysGroupService;

	/**
	 * 查询${tableComment}
	 */
	@GetMapping("get/{groupId}")
	public SysGroup get(@PathVariable("groupId") Long groupId)
	{
		return sysGroupService.selectSysGroupById(groupId);

	}

	/**
	 * 查询角色组列表
	 */
	@GetMapping("list")
	public R list(SysGroup sysGroup)
	{
		startPage();
        return result(sysGroupService.selectSysGroupList(sysGroup));
	}


	/**
	 * 新增保存角色组
	 */
	@PostMapping("save")
	public R addSave(@RequestBody SysGroup sysGroup)
	{
		return toAjax(sysGroupService.insertSysGroup(sysGroup));
	}

	/**
	 * 修改保存角色组
	 */
	@PostMapping("update")
	public R editSave(@RequestBody SysGroup sysGroup)
	{
		return toAjax(sysGroupService.updateSysGroup(sysGroup));
	}

	/**
	 * 删除${tableComment}
	 */
	@PostMapping("remove")
	public R remove(String ids)
	{
		return toAjax(sysGroupService.deleteSysGroupByIds(ids));
	}

}
